<?php

App::import('Model', 'Account');

/**
 * Description of Post
 *
 * @author Abo El Seoud
 */
class Post extends AppModel {

    public function fetchMentions($accountID) {
        $tempAccount = new Account();
        //Fetch mentions from Twitter
        return $tempAccount->connectionRequest($accountID)->get('statuses/mentions');
    }

    public function view($tweetID, $accountID) {
        $tempAccount = new Account();
        $posts = array();
        while (true) {
            $tweet = (array) $tempAccount->connectionRequest($accountID)->get('statuses/show/' . $tweetID);
            array_unshift($posts, $tweet);
            if ($tweet['in_reply_to_status_id_str'] == null) {
                break;
            }
            $tweetID = $tweet['in_reply_to_status_id_str'];
        }
        return $posts;
    }


    

}

?>
